#!/bin/sh
#
# shellinabox Startup script for the shellinabox
#
# chkconfig: - 87 17
# description: web-based shell access
#
# processname: shellinaboxd
# pidfile: /var/run/shellinaboxd.pid
#

# Source function library
. /etc/rc.d/init.d/functions

prog="shellinaboxd"
binary="/usr/bin/shellinaboxd"
RETVAL=0

start() {
	echo -n $"Starting $prog: "
	daemon $binary -s /login:LOGIN -b
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
	return $RETVAL
}

stop() {
	echo -n $"Stopping $prog: "
	killproc $binary
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
	return $RETVAL
}

reload() {
	echo -n $"Reloading $prog: "
	killproc $binary -HUP
	RETVAL=$?
	echo
	return $RETVAL
}

case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		stop
		start
		;;
	status)
		status $binary
		RETVAL=$?
		;;
	*)
		echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}"
		RETVAL=1
esac

exit $RETVAL
